package main

import (
	"app/services/hello/handler"
	pb "app/services/hello/proto"
	"github.com/aWildProgrammer/fconf"
	"github.com/micro/go-log"
	"github.com/micro/go-micro"
	"time"
)

func main() {
	c, err := fconf.NewFileConf("/Users/guijie/Documents/gowork/src/app/configs/service.ini")
	if err != nil {
		log.Fatal(err)
	}
	srvName := c.String("hello.service")
	microSrv := micro.NewService(
		micro.Name(srvName),
		micro.RegisterTTL(time.Second*30),
		micro.RegisterInterval(time.Second*10),
	)
	microSrv.Init()
	hdl := new(handler.Srv)
	_ = pb.RegisterSayHandler(microSrv.Server(), hdl)
	if err := microSrv.Run(); err != nil {
		log.Fatal(err)
	}
}
